package com.xsomnus.network_programming.netty.udpchat;

import com.xsomnus.network_programming.netty.udpchat.config.UdpProperties;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioDatagramChannel;

/**
 * @author @叶小夏
 * @since 2019/8/9 0009 9:59
 * - 才需学也,学需静也/非淡泊无以明志，非宁静无以致远
 */
public class EchoServer {


    public static void main(String[] args) throws InterruptedException {
        Bootstrap bootstrap = new Bootstrap();
        EventLoopGroup eventLoopGroup = new NioEventLoopGroup();

        bootstrap.group(eventLoopGroup)
                .channel(NioDatagramChannel.class)
                .handler(new EchoServerHandler());
        // 服务端监听在9999端口
        bootstrap.bind(UdpProperties.serverUDPPort).sync().channel().closeFuture().await();
    }

}
